<template>
  <el-tabs class="tabDiv" v-model="activeName" tab-position="left" @tab-click="handleClick">
    <el-tab-pane v-for="item of eltabs" :label="item.name" :name="item.id" :key="item.id"></el-tab-pane>
  </el-tabs>
</template>

<script>
export default {
  name: 'tab',
  props: {
    eltabs: {
      type: Array,
      default: () => []
    },
    activeName: {
      type: String,
      default: () => '1'
    },
  },
  data () {
    return {
      activeName: '1'
    }
  },
  methods: {
    handleClick (tab) {
      this.activeName = tab.name
      this.$emit('tabIndex', tab.name)
    }
  }
}
</script>

<style lang="scss" scoped="scoped">
</style>
